// 首页导航模型
const { Navigation } = require('../../../models/navigation');
// 统一数据返回类
const { DataReturn } = require('../../../common/returnclass');

/**
 * @api {Post} /links 添加导航链接
 * @apiGroup Admin-Links
 *
 * @apiParam {ObjectId} id 分类id
 * @apiParam {String} title 导航名称
 * @apiParam {String} icon 图标地址
 *
 * @apiSuccess {Number} code 状态码
 * @apiSuccess {Object} data 返回数据
 * @apiSuccess {String} msg  返回消息
 */
module.exports = async (req, res) => {
	let { title,icon,id } = req.fields;
	console.log(req.fields);
	
	 await Navigation.create({ title,icon,cate_id})
	 
	 DataReturn.getData(res,200,[],'添加导航成功')
	 

	
	Navigation.updateOne()
	.then(()=>{
		DataReturn.getData(res,200,orders,'订单创建成功')
	}).catch(()=>{
		DataReturn.getData(res,400,[],'订单创建失败')
	})

}
